<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Kalnoy\Nestedset\NodeTrait;

class Category extends Model
{
    use HasFactory;
    use NodeTrait; // 嵌套集合模型 Nestedset 扩展

    public $timestamps = false;

    protected $fillable = [
        'name', '_lft', '_rgt', 'parent_id', 'description'
    ];

    // bookmarks 表外键 category_id 一对多关联 category 模型
    public function Bookmark()
    {
        return $this->hasMany('App\Models\Bookmark');
    }
}
